//
//  mGiftConfirmResult.swift
//  ShopIOS
//
//  Created by Apple on 2019/8/9.
//  Copyright © 2019 Apple. All rights reserved.
//

import Foundation
import SwiftyJSON

struct mGiftConfrimResult {
    var GiftList = [mGiftConfrimGiftList]()
    var TotalAmount: Int = 0
    var ShipAddress: mGiftConfrimShipAddress?
    var GiftValueTotal: Int = 0
    
    init(json: JSON) {
        GiftList = json["GiftList"].arrayValue.compactMap({ mGiftConfrimGiftList(json: $0)})
        TotalAmount = json["TotalAmount"].intValue
        ShipAddress = mGiftConfrimShipAddress(json: json["ShipAddress"])
        GiftValueTotal = json["GiftValueTotal"].intValue
    }
}

struct mGiftConfrimShipAddress {
    var RegionFullName: String?
    var Phone: String?
    var IsDefault: Bool = false
    var Id: Int = 0
    var UserId: Int = 0
    var RegionId: Int = 0
    var ShipTo: String?
    var IsQuick: Bool = false
    var Address: String?
    
    init(json: JSON) {
        RegionFullName = json["RegionFullName"].stringValue
        Phone = json["Phone"].stringValue
        IsDefault = json["IsDefault"].boolValue
        Id = json["Id"].intValue
        UserId = json["UserId"].intValue
        RegionId = json["RegionId"].intValue
        ShipTo = json["ShipTo"].stringValue
        IsQuick = json["IsQuick"].boolValue
        Address = json["Address"].stringValue
    }
}

struct mGiftConfrimGiftList {
    var GiftId: Int = 0
    var Id: Int = 0
    var SaleIntegral: Int = 0
    var ImagePath: String?
    var DefaultImage: String?
    var Quantity: Int = 0
    var GiftName: String?
    var OrderId: Int = 0
    var GiftValue: Int = 0
    
    init(json: JSON) {
        GiftId = json["GiftId"].intValue
        Id = json["Id"].intValue
        SaleIntegral = json["SaleIntegral"].intValue
        ImagePath = json["ImagePath"].stringValue
        DefaultImage = json["DefaultImage"].stringValue
        Quantity = json["Quantity"].intValue
        GiftName = json["GiftName"].stringValue
        OrderId = json["OrderId"].intValue
        GiftValue = json["GiftValue"].intValue
    }
}

